package treeMap.test1;

import java.util.Comparator;
import java.util.TreeMap;

public class Test1 {
    public static void main(String[] args) {
        TreeMap<Integer,String> ts = new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        ts.put(1,"水");
        ts.put(2,"面包");
        ts.put(3,"饼干");
        System.out.println(ts);

    }
}